<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>v-model 高级用法</title>
		<script src="../vue@3.2.23.js"></script>
	</head>
	<body>
		<div id="app">
			<temp :count="count" v-model:count="count"></temp>
		</div>
	</body>
</html>
<script>
	const temp={
		props:['count'],
		template:`
			<div>局部组件count{{count}}</div>
			<button @click="add()">修改count</button>
		`,
		methods:{
			add(){
				this.$emit('update:count',this.count+1)
			}
		}
	}
	const app=Vue.createApp({
		components:{
			temp
		},
		data() {
			return{
				count:1,
				msg:'hello vue'
			}
		}
	})
	const vm = app.mount('#app')
</script>